<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
	<ul class="nav nav-tabs">
		<li><a href="{:url('Order/question')}">问题列表</a></li>
	</ul>
	<form action="{:url('Question/save')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
		<div class="row">
			<div class="col-md-9">
				<table class="table table-bordered" id="a">
					<tr>
						<th width="100px">问题<span class="form-required">*</span></th>
						<td>
							<input class="form-control" type="text" name="q_content" 
								   id="q_content" required  placeholder="请输入问题"/>
						</td>
					</tr>
						<tr>
							<th width="100px">答案<span class="form-required">*</span></th>
							<td>
								<input class="form-control" type="text" name="a_content[]"
									   id="a_content" required  placeholder="请输入答案"/>
									   
							</td>
							<td><input type="button" value="+" id="addTable"/></td>
							
						</tr>
						
				</table>
				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
						<a class="btn btn-default" href="{:url('Order/question')}">{:lang('BACK')}</a>
					</div>
				</div>
			</div>
		</div>
	</form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });



    $(document).ready(function(){
            $("#addTable").click(function(){
                var tr='<tr><th width="100px">答案<span class="form-required">*</span></th><td><input class="form-control" type="text" name="a_content[]" id="a_content" required  placeholder="请输入答案"/></td><input type="button" value="+" id="addTable"/>'+"</td><td><input type=\"button\" id='del'  value='-'/></td></tr>";
        $("#a").append(tr);
            });

// 删除

            $("#deleteTable").click(function(){
                var check = document.getElementsByName("check");
                for(var i=1;i<=check.length;i++){
                    if(check[i].checked){
                        document.getElementById('a').deleteRow(i);
                    }
                }
            })
        })
 $(document).on("click","#del",function()
        {
            var del=$(this);
            del.parent().parent().remove();
        })
</script>
</body>
</html>
